<?php
/**
 * Custom autoloader function.
 * Autoload is run by PHP whenever a requested class is not already loaded.
 * All classes are named so that they can easily be loaded
 * dynamically. Class name must reflect its location relative to the
 * project path.
 * @param $className Name of the class to be loaded
 * @return void
 */
defined('DS') || define('DS',DIRECTORY_SEPARATOR);

function SSAutoloader($className)
{
    $_class = strtolower($className);
    if (substr($_class, 0, 16) === 'smarty_internal_' || $_class == 'smarty_security')
    {
        include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
    }
    else
    {
        $classNameParts = explode('_', $className);

        foreach($classNameParts as $lvl => $part)
            $classNameParts[$lvl] = ucfirst($part);
        
        $classFile = implode(DS, $classNameParts).'.php';
        include_once($classFile);
    }
}

spl_autoload_register('SSAutoloader');

$sourceRoot = dirname(dirname(__FILE__)).'/Source/';
$testRoot = dirname(dirname(__FILE__)).'/Test/';
set_include_path(  $sourceRoot. ':' .$testRoot.':'. get_include_path() );